﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="StaffAdd.aspx.cs" Inherits="CRMWebSite.Manage.SystemMaintain.StaffManagement.StaffAdd" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
    <link href="../../Styles/AddStaff.css" rel="stylesheet" type="text/css" />
    <title></title>
    
    <script type="text/javascript"  language="javascript">
        function Save() {
            if (document.getElementById("txtName").value == "" ||
                document.getElementById("txtId").value == "" ||
                //document.getElementById("txtPassword").value == "" ||
                document.getElementById("txtDepartment").value == "" ) {
                document.getElementById("lblMessage").innerText = "* 必填项不能为空!";
                return;
            }
            else {
                document.getElementById("lblMessage").innerText = "";
                document.getElementById("imgbtnSave").click();
            }
        }
        //为空验证函数
        function emptyCheck(str) {
            if (event.srcElement.value == "") {
                document.getElementById("lblMessage").innerText = "* " + str;
            }
            else {
                document.getElementById("lblMessage").innerText = "";
            }
        }

        //正则表达式验证函数
        //验证格式和是否为空
        //reg 正则表达式格式
        //val 标题名
        //str 错误提示信息
        function regCheck(reg, val, str) {
            var text = event.srcElement.value;

            if (text == "") {
                document.getElementById("lblMessage").innerText = "* " + val + "不能为空!";
                return;
            }
            if (!reg.test(text)) {
                document.getElementById("lblMessage").innerText = "* " + str;
            }
//            if(text.indexOf("")!=-1){
//                document.getElementById("lblMessage").innerText = "* " + "不能有空格!";
//                return;
//            }           
            else {
                document.getElementById("lblMessage").innerText = "";
            }
        }
        //正则表达式验证函数
        //只验证格式是否正确
        //reg 正则表达式格式
        //val 标题名
        //str 错误提示信息
        function Check(reg, val, str) {
            var text = event.srcElement.value;
            if (!reg.test(text)&&text!="") {
                document.getElementById("lblMessage").innerText = "* " + str;
            }
            else {
                document.getElementById("lblMessage").innerText = "";
            }
        }
    </script>
   

</head>
<body style="width:670px; height:446px; margin-left:100px; border:1px solid #a7a7a7;">
    <form id="form1" runat="server" style="width:670px;height:448px;">
    <div class="rowHead"><span style=" font-size:14px;">员工信息添加</span><span 
            style=" float:right; clip: rect(auto, auto, 10px, auto);"> 
        <asp:LinkButton ID="lnkbtnReturn" 
        runat="server" ForeColor="black" 
        Font-Size="14px" onclick="lnkbtnReturn_Click" >返回上一级</asp:LinkButton></span>
       </div> 
    <div style="background: url('../../../Image/Staff/stick.png') repeat-x; height: 416px;">
        
        <div class="rowTwo" style=" padding-top:45px;">
        <div class=" rowTwo" style="margin-left:50px;">个人信息(<span style="color:Red">*</span>表示必填字段)</div>
     </div>
       
        <div style=" height:150px;">
         <!--左半侧-->
        <div class="RowLeft">

            <div class="rowTwo">
     <div class=" RowColumn1"><span style="color:Red">*</span>
        姓名：
         </div>
     <div class="RowColumn2">
         <asp:TextBox ID="txtName" runat="server" Width="135px"
         onblur="regCheck(/[\u4e00-\u9fa5a-zA-Z]+$/,'姓名','姓名只能是汉字或字母!')" MaxLength="10" ></asp:TextBox>
     </div>
     </div>

            <div class="rowTwo">
                <div class=" RowColumn1">
                <span style="color:Red">*</span>
                工号：
            </div>
        <div class="RowColumn2">
            <asp:TextBox ID="txtId" runat="server" Width="135px"  onkeyup="value=value.replace(' ','')" 
                onblur="regCheck(/[\d\w@#\(\)\+]$/,'工号','工号只能为字母、数字!')" MaxLength="10"></asp:TextBox>
         </div>
     </div>

            <div class="rowTwo">
        <div class=" RowColumn1">
            <span style="color:Red">*</span>
             部门：
         </div>
        <div class="RowColumn2">
            <asp:TextBox ID="txtDepartment" runat="server"  Width="135px" onkeyup="value=value.replace(' ','')"  
                onblur="regCheck(/[a-zA-Z]{1,20}|[\u4e00-\u9fa5]{1,10}$/ ,'部门','部门只能是汉字或字母!')" MaxLength="10"></asp:TextBox> 
         </div>
     </div>

           

     </div>
     <!--右半侧-->
        <div class="RowRight">
            <div class="rowTwo">
                <div class=" RowColumn1">性别：</div>
                <div class="RowColumn2">
                <asp:DropDownList ID="ddlSex" runat="server" 
                Height="23px" Width="135px">
                    <asp:ListItem>男</asp:ListItem>
                    <asp:ListItem>女</asp:ListItem>
                </asp:DropDownList>
                </div>
            </div>
      
            <%--<div class="rowTwo">
                <div class=" RowColumn1">密码：</div>
                <div class="RowColumn2">
                    <input id="txt_Password"  runat="server" style="width:130px" type="password" 
                        readonly="readonly" />
                   
                </div>
            </div>--%>

            <div class="rowTwo">
                <div class=" RowColumn1">在职状态：</div>
                <div class="RowColumn2">
                    <asp:DropDownList ID="ddlState" runat="server" 
                    Height="25px" Width="135px">
                        <asp:ListItem>在职</asp:ListItem>
                        <asp:ListItem>离职</asp:ListItem>
                     </asp:DropDownList>   
            
                </div>
            </div>
             <div class="rowTwo">
                <div class=" RowColumn1">
                职务：
                </div>
            <div class="RowColumn2">
              <asp:TextBox ID="txtPosition" runat="server" Width="135px" onkeyup="value=value.replace(' ','')" 
              onblur="regCheck(/[a-zA-Z]{1,20}|[\u4e00-\u9fa5]{1,10}$/ ,'职务','职务只能是汉字或字母!')" MaxLength="10"></asp:TextBox>
            </div>
     </div>

        </div>
     </div>
    
     <div class=" rowTwo"  style="margin-left:50px;">联系方式</div>
     <div style=" height:100px;">
     
        <div class="RowLeft">
        <div class="rowTwo">
            <div class="RowColumn1">
                电话：
            </div>
            <div class="RowColumn2">
                <asp:TextBox ID="txtTelphone" runat="server"  Width="135px" onkeyup="value=value.replace(' ','')" 
                onblur="regCheck(/^[+]{0,1}(\d){1,3}[ ]?([-]?((\d)|[ ]){1,12})+$/,'电话','电话格式不正确!')" MaxLength="20"></asp:TextBox>
            </div>
        </div>
    </div>
    
        <div class="RowRight">
        <div class="rowTwo">
            <div class="RowColumn1">
                Email：
            </div>
            <div class="RowColumn2">
                <asp:TextBox ID="txtEmail" runat="server" Width="125px" onkeyup="value=value.replace(' ','')" 
                 
                    onblur="Check(/^([a-z0-9_\.-]+)@([\da-z\.-]+)\.([a-z\.]{2,6})$/,'Email','Email格式不正确！') " 
                    MaxLength="20"   ></asp:TextBox>
            </div>
        </div>
        </div>
     </div>
     <center>
     <div>
   <asp:Label ID="lblMessage"  Width ="135px" runat="server" ForeColor="Red"></asp:Label></div>
    <div>
     <asp:ImageButton ID="imgbtnSave" runat="server" style=" display:none;" onclick="imgbtnSave_Click" />
     <img alt="保存" src="../../images/ManageImages/btnsave.png" onclick="Save()" 
            style="cursor: pointer;" />
 </div>
 </center>
    </div>
  
    </form>
</body>
</html>
